import {useState, useEffect} from 'react';
import axios from 'axios';

export default function HomeIndex (){
    const [data, setData] = useState('home-index');
    // const [isLoading, setIsLoading] = useState(false);
    // const [err, setErr] = useState('');

    useEffect(() => {
        axios.get('api/token').then(res => {
            const user = JSON.parse(res.data.user);
            setData(user.name);
        }).catch(err => {
            console.log(err);
        });
    }, []);
  
    return (
        <div>hello {data}</div>
    )
}
